package com.cskaoyan.mall.controller.admin;

import com.cskaoyan.mall.bean.Issue;
import com.cskaoyan.mall.bean.bo.IssueListBO;
import com.cskaoyan.mall.bean.vo.GeneralItemsBean;
import com.cskaoyan.mall.bean.vo.ResultVO;
import com.cskaoyan.mall.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: dyj
 * @Date: 2021/1/10 23:51
 * @Description 商场模块 通用问题模块
 */
@RestController
@RequestMapping("/admin/issue")
public class IssueController {

    @Autowired
    IssueService issueService;

    @RequestMapping("list")
    public ResultVO list(IssueListBO issueListBO){
        GeneralItemsBean itemsBean = issueService.selectIssueList(issueListBO);
        return ResultVO.ok(itemsBean);
    }

    @RequestMapping("create")
    public ResultVO create(@RequestBody Issue issue){
        issueService.createIssue(issue);
        return ResultVO.ok(issue);
    }

    @RequestMapping("update")
    public ResultVO update(@RequestBody Issue issue){
        issueService.updateIssueById(issue);
        return ResultVO.ok(issue);
    }

    @RequestMapping("delete")
    public ResultVO delete(@RequestBody Issue issue){
        issueService.deleteIssue(issue.getId());
        return ResultVO.ok(
        );
    }
}
